<!DOCTYPE html>
<html>
  <head>
    <title>
      oscillator-ended.html
    </title>
    <script src="../../resources/testharness.js"></script>
    <script src="../../resources/testharnessreport.js"></script>
    <script src="../resources/audit-util.js"></script>
    <script src="../resources/audit.js"></script>
    <script src="../resources/audiobuffersource-testing.js"></script>
  </head>
  <body>
    <script id="layout-test-code">
      let audit = Audit.createTaskRunner();

      let context;
      let source;

      audit.define('test', function(task, should) {

        let sampleRate = 44100.0;
        let lengthInSeconds = 0.1;
        context = new OfflineAudioContext(
            1, sampleRate * lengthInSeconds, sampleRate);
        osc = context.createOscillator();
        osc.type = 'sine';
        osc.connect(context.destination);
        osc.onended = function() {
          should(true, 'osc.onended was called').beTrue();
          task.done();
        };
        osc.start(0);
        osc.stop(0.1);
        context.startRendering();
      });

      audit.run();
    </script>
  </body>
</html>
